package com.next

class Contact
{
    Date createdDate = new Date()
    Date modifiedDate = new Date()

    String fullName
    String cellphone
    String idNumber
    String level = "C"

    String city
    String address

    String openId

    String avatarUrl

    String wechatNumber
    // 联系人微信号

    static hasMany = [opportunities: Opportunity]

    static constraints = {
        fullName blank: true, nullable: true
        cellphone blank: true, nullable: true
        cellphone matches: /^1\d{10}$/
        city blank: true, nullable: true
        idNumber blank: true, nullable: true
        level inList: ["A", "B", "C"]
        level blank: true, nullable: true
        address blank: true, nullable: true

        openId maxSize: 32, unique: true
        openId blank: false, nullable: false
        
        avatarUrl blank: true, nullable: true

        wechatNumber blank: true, nullable: true
    }
}
